home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / include / afxdlgs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  24.7 KB  |  836 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #ifndef __AFXDLGS_H__
  11. #define __AFXDLGS_H__
  12.  
  13. #ifndef __AFXWIN_H__
  14.     #include <afxwin.h>
  15. #endif
  16.  
  17. #ifndef _INC_COMMDLG
  18.     #include <commdlg.h>    // common dialog APIs
  19. #endif
  20.  
  21. // Avoid mapping GetFileTitle to GetFileTitle[A/W]
  22. #ifdef GetFileTitle
  23. #undef GetFileTitle
  24. AFX_INLINE short APIENTRY GetFileTitle(LPCTSTR lpszFile, LPTSTR lpszTitle, WORD cbBuf)
  25. #ifdef UNICODE
  26.     { return ::WCE_FCTN(GetFileTitleW)(lpszFile, lpszTitle, cbBuf); }
  27. #else
  28.     { return ::GetFileTitleA(lpszFile, lpszTitle, cbBuf); }
  29. #endif
  30. #endif
  31.  
  32. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  33.     #ifndef _RICHEDIT_
  34.         #include <richedit.h>
  35.     #endif
  36. #endif
  37.  
  38. #ifdef _AFX_MINREBUILD
  39. #pragma component(minrebuild, off)
  40. #endif
  41. #ifndef _AFX_FULLTYPEINFO
  42. #pragma component(mintypeinfo, on)
  43. #endif
  44.  
  45. #ifndef _AFX_NOFORCE_LIBS
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Win32 libraries
  49.  
  50. #endif //!_AFX_NOFORCE_LIBS
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53.  
  54. #ifdef _AFX_PACKING
  55. #pragma pack(push, _AFX_PACKING)
  56. #endif
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // AFXDLGS - MFC Standard dialogs
  60.  
  61. // Classes declared in this file
  62.  
  63.     // CDialog
  64.         class CCommonDialog;  // implementation base class
  65.  
  66.             // modeless dialogs
  67.             class CFindReplaceDialog; // Find/FindReplace dialog
  68.  
  69.             // modal dialogs
  70.             class CFileDialog;    // FileOpen/FileSaveAs dialogs
  71.             class CColorDialog;   // Color picker dialog
  72.             class CFontDialog;    // Font chooser dialog
  73.             class CPrintDialog;   // Print/PrintSetup dialogs
  74.             class CPageSetupDialog; // Page Setup dialog
  75.  
  76.     // CWnd
  77.     class CPropertySheet;     // implements tabbed dialogs
  78.         class CPropertySheetEx;
  79.  
  80.     // CDialog
  81.         class CPropertyPage;  // Used with CPropertySheet for tabbed dialogs
  82.             class CPropertyPageEx;
  83.  
  84. /////////////////////////////////////////////////////////////////////////////
  85.  
  86. #undef AFX_DATA
  87. #define AFX_DATA AFX_CORE_DATA
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CCommonDialog - base class for all common dialogs
  91.  
  92. #ifdef _AFXDLL
  93. class CCommonDialog : public CDialog
  94. #else
  95. class AFX_NOVTABLE CCommonDialog : public CDialog
  96. #endif
  97. {
  98. WCE_INS DECLARE_DYNAMIC(CCommonDialog) // WinCE: need this for IsKindOf
  99. public:
  100.     CCommonDialog(CWnd* pParentWnd);
  101.  
  102. // Implementation
  103. protected:
  104.     virtual void OnOK();
  105.     virtual void OnCancel();
  106.  
  107.     //{{AFX_MSG(CCommonDialog)
  108.     afx_msg BOOL OnHelpInfo(HELPINFO*);
  109.     //}}AFX_MSG
  110.     DECLARE_MESSAGE_MAP()
  111. };
  112.  
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CFileDialog - used for FileOpen... or FileSaveAs...
  115.  
  116. class CFileDialog : public CCommonDialog
  117. {
  118.     DECLARE_DYNAMIC(CFileDialog)
  119.  
  120. public:
  121. // Attributes
  122.     OPENFILENAME m_ofn; // open file parameter block
  123.  
  124. // Constructors
  125.     CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
  126.         LPCTSTR lpszDefExt = NULL,
  127.         LPCTSTR lpszFileName = NULL,
  128.         DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
  129.         LPCTSTR lpszFilter = NULL,
  130.         CWnd* pParentWnd = NULL);
  131.  
  132. // Operations
  133.     virtual int DoModal();
  134.  
  135.     // Helpers for parsing file name after successful return
  136.     // or during Overridable callbacks if OFN_EXPLORER is set
  137.     CString GetPathName() const;  // return full path and filename
  138.     CString GetFileName() const;  // return only filename
  139.     CString GetFileExt() const;   // return only ext
  140.     CString GetFileTitle() const; // return file title
  141.     BOOL GetReadOnlyPref() const; // return TRUE if readonly checked
  142.  
  143.     // Enumerating multiple file selections
  144.     POSITION GetStartPosition() const;
  145.     CString GetNextPathName(POSITION& pos) const;
  146.  
  147.     // Helpers for custom templates
  148.     void SetTemplate(UINT nWin3ID, UINT nWin4ID);
  149.     void SetTemplate(LPCTSTR lpWin3ID, LPCTSTR lpWin4ID);
  150.  
  151.     // Other operations available while the dialog is visible
  152.     CString GetFolderPath() const; // return full path
  153.     void SetControlText(int nID, LPCSTR lpsz);
  154.     void HideControl(int nID);
  155.     void SetDefExt(LPCSTR lpsz);
  156.  
  157. // Overridable callbacks
  158. protected:
  159.     friend UINT CALLBACK _AfxCommDlgProc(HWND, UINT, WPARAM, LPARAM);
  160.     virtual UINT OnShareViolation(LPCTSTR lpszPathName);
  161.     virtual BOOL OnFileNameOK();
  162.     virtual void OnLBSelChangedNotify(UINT nIDBox, UINT iCurSel, UINT nCode);
  163.  
  164.     // only called back if OFN_EXPLORER is set
  165.     virtual void OnInitDone();
  166.     virtual void OnFileNameChange();
  167.     virtual void OnFolderChange();
  168.     virtual void OnTypeChange();
  169.  
  170. // Implementation
  171. #ifdef _DEBUG
  172. public:
  173.     virtual void Dump(CDumpContext& dc) const;
  174. #endif
  175.  
  176. protected:
  177.     BOOL m_bOpenFileDialog;       // TRUE for file open, FALSE for file save
  178.     CString m_strFilter;          // filter string
  179.                         // separate fields with '|', terminate with '||\0'
  180.     TCHAR m_szFileTitle[64];       // contains file title after return
  181.     TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return
  182.  
  183.     OPENFILENAME*  m_pofnTemp;
  184.  
  185.     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  186. };
  187.  
  188. #if !defined(_WIN32_WCE)
  189. /////////////////////////////////////////////////////////////////////////////
  190. // CFontDialog - used to select a font
  191.  
  192. class CFontDialog : public CCommonDialog
  193. {
  194.     DECLARE_DYNAMIC(CFontDialog)
  195.  
  196. public:
  197. // Attributes
  198.     // font choosing parameter block
  199.     CHOOSEFONT m_cf;
  200.  
  201. // Constructors
  202.     CFontDialog(LPLOGFONT lplfInitial = NULL,
  203.         DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS,
  204.         CDC* pdcPrinter = NULL,
  205.         CWnd* pParentWnd = NULL);
  206. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  207.     CFontDialog(const CHARFORMAT& charformat,
  208.         DWORD dwFlags = CF_SCREENFONTS,
  209.         CDC* pdcPrinter = NULL,
  210.         CWnd* pParentWnd = NULL);
  211. #endif
  212. // Operations
  213.     virtual int DoModal();
  214.  
  215.     // Get the selected font (works during DoModal displayed or after)
  216.     void GetCurrentFont(LPLOGFONT lplf);
  217.  
  218.     // Helpers for parsing information after successful return
  219.     CString GetFaceName() const;  // return the face name of the font
  220.     CString GetStyleName() const; // return the style name of the font
  221.     int GetSize() const;          // return the pt size of the font
  222.     COLORREF GetColor() const;    // return the color of the font
  223.     int GetWeight() const;        // return the chosen font weight
  224.     BOOL IsStrikeOut() const;     // return TRUE if strikeout
  225.     BOOL IsUnderline() const;     // return TRUE if underline
  226.     BOOL IsBold() const;          // return TRUE if bold font
  227.     BOOL IsItalic() const;        // return TRUE if italic font
  228. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  229.     void GetCharFormat(CHARFORMAT& cf) const;
  230. #endif
  231.  
  232. // Implementation
  233.     LOGFONT m_lf; // default LOGFONT to store the info
  234. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  235.     DWORD FillInLogFont(const CHARFORMAT& cf);
  236. #endif
  237.  
  238. #ifdef _DEBUG
  239. public:
  240.     virtual void Dump(CDumpContext& dc) const;
  241. #endif
  242.  
  243. protected:
  244.     TCHAR m_szStyleName[64]; // contains style name after return
  245. };
  246. #endif // _WIN32_WCE
  247.  
  248. #if !defined(_WIN32_WCE_NO_COLORDLG)
  249. /////////////////////////////////////////////////////////////////////////////
  250. // CColorDialog - used to select a color
  251.  
  252. class CColorDialog : public CCommonDialog
  253. {
  254.     DECLARE_DYNAMIC(CColorDialog)
  255.  
  256. public:
  257. // Attributes
  258.     // color chooser parameter block
  259.     CHOOSECOLOR m_cc;
  260.  
  261. // Constructors
  262.     CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0,
  263.             CWnd* pParentWnd = NULL);
  264.  
  265. // Operations
  266.     virtual int DoModal();
  267.  
  268.     // Set the current color while dialog is displayed
  269. WCE_DEL void SetCurrentColor(COLORREF clr);
  270.  
  271.     // Helpers for parsing information after successful return
  272.     COLORREF GetColor() const;
  273.     static COLORREF* PASCAL GetSavedCustomColors();
  274.  
  275. // Overridable callbacks
  276. protected:
  277.     friend UINT CALLBACK _AfxCommDlgProc(HWND, UINT, WPARAM, LPARAM);
  278.     virtual BOOL OnColorOK();       // validate color
  279.  
  280. // Implementation
  281.  
  282. #ifdef _DEBUG
  283. public:
  284.     virtual void Dump(CDumpContext& dc) const;
  285. #endif
  286.  
  287. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  288. protected:
  289.     //{{AFX_MSG(CColorDialog)
  290.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  291.     //}}AFX_MSG
  292.     DECLARE_MESSAGE_MAP()
  293. #endif //!_AFX_NO_GRAYDLG_SUPPORT
  294. };
  295.  
  296. // for backward compatibility clrSavedCustom is defined as GetSavedCustomColors
  297. #define clrSavedCustom GetSavedCustomColors()
  298. #endif // _WIN32_WCE_NO_COLORDLG
  299.  
  300. #if !defined(_WIN32_WCE)
  301. /////////////////////////////////////////////////////////////////////////////
  302. // Page Setup dialog
  303.  
  304. class CPageSetupDialog : public CCommonDialog
  305. {
  306.     DECLARE_DYNAMIC(CPageSetupDialog)
  307.  
  308. public:
  309. // Attributes
  310.     PAGESETUPDLG m_psd;
  311.  
  312. // Constructors
  313.     CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE,
  314.         CWnd* pParentWnd = NULL);
  315.  
  316. // Attributes
  317.     LPDEVMODE GetDevMode() const;   // return DEVMODE
  318.     CString GetDriverName() const;  // return driver name
  319.     CString GetDeviceName() const;  // return device name
  320.     CString GetPortName() const;    // return output port name
  321.     HDC CreatePrinterDC();
  322.     CSize GetPaperSize() const;
  323.     void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const;
  324.  
  325. // Operations
  326.     virtual int DoModal();
  327.  
  328. // Overridables
  329.     virtual UINT PreDrawPage(WORD wPaper, WORD wFlags, LPPAGESETUPDLG pPSD);
  330.     virtual UINT OnDrawPage(CDC* pDC, UINT nMessage, LPRECT lpRect);
  331.  
  332. // Implementation
  333. protected:
  334.     static UINT CALLBACK PaintHookProc(HWND hWnd, UINT message, WPARAM wParam,
  335.         LPARAM lParam);
  336.  
  337. #ifdef _DEBUG
  338. public:
  339.     virtual void Dump(CDumpContext& dc) const;
  340. #endif
  341. };
  342. #endif // _WIN32_WCE
  343.  
  344. #if !defined(_WIN32_WCE_NO_PRINTING)
  345. /////////////////////////////////////////////////////////////////////////////
  346. // CPrintDialog - used for Print... and PrintSetup...
  347.  
  348. class CPrintDialog : public CCommonDialog
  349. {
  350.     DECLARE_DYNAMIC(CPrintDialog)
  351.  
  352. public:
  353. // Attributes
  354.     // print dialog parameter block (note this is a reference)
  355.     PRINTDLG& m_pd;
  356. // WinCE: the following values replace the original PRINTDLG members
  357. WCE_INS WORD m_nFromPage;
  358. WCE_INS WORD m_nToPage;
  359. WCE_INS WORD m_nMinPage;
  360. WCE_INS WORD m_nMaxPage;
  361. WCE_INS WORD m_nCopies; 
  362.  
  363. // Constructors
  364.     CPrintDialog(BOOL bPrintSetupOnly,
  365.         // TRUE for Print Setup, FALSE for Print Dialog
  366. #if defined(_WIN32_WCE)
  367.         DWORD dwFlags = 0,
  368. #else // _WIN32_WCE
  369.         DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS
  370.             | PD_HIDEPRINTTOFILE | PD_NOSELECTION,
  371. #endif // _WIN32_WCE
  372.         CWnd* pParentWnd = NULL);
  373.  
  374. // Operations
  375.     virtual int DoModal();
  376.  
  377.     // GetDefaults will not display a dialog but will get
  378.     // device defaults
  379.     BOOL GetDefaults();
  380.  
  381.     // Helpers for parsing information after successful return
  382.     int GetCopies() const;          // num. copies requested
  383. WCE_DEL BOOL PrintCollate() const;      // TRUE if collate checked
  384.     BOOL PrintSelection() const;    // TRUE if printing selection
  385.     BOOL PrintAll() const;          // TRUE if printing all pages
  386. WCE_DEL BOOL PrintRange() const;        // TRUE if printing page range
  387. WCE_DEL int GetFromPage() const;        // starting page if valid
  388. WCE_DEL int GetToPage() const;          // starting page if valid
  389. WCE_DEL LPDEVMODE GetDevMode() const;   // return DEVMODE
  390. WCE_DEL CString GetDriverName() const;  // return driver name
  391.     CString GetDeviceName() const;  // return device name
  392.     CString GetPortName() const;    // return output port name
  393.     HDC GetPrinterDC() const;       // return HDC (caller must delete)
  394. WCE_INS CSize GetPaperSize() const;
  395. WCE_INS void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const;
  396. WCE_INS BOOL PrintDraft() const;
  397.  
  398.     // This helper creates a DC based on the DEVNAMES and DEVMODE structures.
  399.     // This DC is returned, but also stored in m_pd.hDC as though it had been
  400.     // returned by CommDlg.  It is assumed that any previously obtained DC
  401.     // has been/will be deleted by the user.  This may be
  402.     // used without ever invoking the print/print setup dialogs.
  403.  
  404. WCE_DEL HDC CreatePrinterDC();
  405.  
  406. // Implementation
  407.  
  408. #ifdef _DEBUG
  409. public:
  410.     virtual void Dump(CDumpContext& dc) const;
  411. #endif
  412.  
  413. private:
  414.     PRINTDLG m_pdActual; // the Print/Print Setup need to share this
  415. protected:
  416.     // The following handle the case of print setup... from the print dialog
  417.     CPrintDialog(PRINTDLG& pdInit);
  418.     virtual CPrintDialog* AttachOnSetup();
  419.  
  420.     //{{AFX_MSG(CPrintDialog)
  421. WCE_DEL afx_msg void OnPrintSetup();
  422.     //}}AFX_MSG
  423.     DECLARE_MESSAGE_MAP()
  424. };
  425. #endif // _WIN32_WCE_NO_PRINTING
  426.  
  427. #if !defined(_WIN32_WCE_NO_FINDREPLACE)
  428. /////////////////////////////////////////////////////////////////////////////
  429. // Find/FindReplace modeless dialogs
  430.  
  431. class CFindReplaceDialog : public CCommonDialog
  432. {
  433.     DECLARE_DYNAMIC(CFindReplaceDialog)
  434.  
  435. public:
  436. // Attributes
  437.     FINDREPLACE m_fr;
  438.  
  439. // Constructors
  440.     CFindReplaceDialog();
  441.     // Note: you must allocate these on the heap.
  442.     //  If you do not, you must derive and override PostNcDestroy()
  443.  
  444.     BOOL Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace
  445.             LPCTSTR lpszFindWhat,
  446.             LPCTSTR lpszReplaceWith = NULL,
  447.             DWORD dwFlags = FR_DOWN,
  448.             CWnd* pParentWnd = NULL);
  449.  
  450.     // find/replace parameter block
  451.     static CFindReplaceDialog* PASCAL GetNotifier(LPARAM lParam);
  452.  
  453. // Operations
  454.     // Helpers for parsing information after successful return
  455.     CString GetReplaceString() const;// get replacement string
  456.     CString GetFindString() const;   // get find string
  457.     BOOL SearchDown() const;         // TRUE if search down, FALSE is up
  458.     BOOL FindNext() const;           // TRUE if command is find next
  459.     BOOL MatchCase() const;          // TRUE if matching case
  460.     BOOL MatchWholeWord() const;     // TRUE if matching whole words only
  461.     BOOL ReplaceCurrent() const;     // TRUE if replacing current string
  462.     BOOL ReplaceAll() const;         // TRUE if replacing all occurrences
  463.     BOOL IsTerminating() const;      // TRUE if terminating dialog
  464.  
  465. // Implementation
  466. protected:
  467.     virtual void PostNcDestroy();
  468.  
  469. #ifdef _DEBUG
  470. public:
  471.     virtual void Dump(CDumpContext& dc) const;
  472. #endif
  473.  
  474. protected:
  475.     TCHAR m_szFindWhat[128];
  476.     TCHAR m_szReplaceWith[128];
  477. #if defined(_WIN32_WCE)
  478. public:
  479.     void EndDialog(int nEndID);
  480. protected:
  481.     // for dialog data exchange and validation
  482.     virtual void DoDataExchange(CDataExchange* pDX);
  483.  
  484.     // Generated message map functions
  485.     //{{AFX_MSG(CFindReplaceDialog)
  486.     afx_msg void OnOK() ;
  487.     afx_msg void OnCancel() ;
  488.     afx_msg void OnReplace();
  489.     afx_msg void OnReplaceAll();
  490.     afx_msg void OnHelp();
  491.     afx_msg void OnFindTextChanged();
  492.     //}}AFX_MSG
  493.     DECLARE_MESSAGE_MAP()
  494. #endif // _WIN32_WCE
  495. };
  496. #endif // _WIN32_WCE_NO_FINDREPLACE
  497.  
  498. ////////////////////////////////////////////////////////////////////////////
  499. // CPropertyPage -- one page of a tabbed dialog
  500.  
  501. #if defined(_WIN32_WCE)
  502. #define AFX_OLDPROPSHEETPAGE PROPSHEETPAGE
  503. #define AFX_OLDPROPSHEETHEADER PROPSHEETHEADER
  504. #else // _WIN32_WCE
  505. // MFC needs to use the original Win95 version of the PROPSHEETPAGE structure.
  506.  
  507. typedef struct _AFX_OLDPROPSHEETPAGE {
  508.         DWORD           dwSize;
  509.         DWORD           dwFlags;
  510.         HINSTANCE       hInstance;
  511.         union {
  512.             LPCTSTR          pszTemplate;
  513. #ifdef _WIN32
  514.             LPCDLGTEMPLATE  pResource;
  515. #else
  516.             const VOID FAR *pResource;
  517. #endif
  518.         } DUMMYUNIONNAME;
  519.         union {
  520.             HICON       hIcon;
  521.             LPCSTR      pszIcon;
  522.         } DUMMYUNIONNAME2;
  523.         LPCTSTR          pszTitle;
  524.         DLGPROC         pfnDlgProc;
  525.         LPARAM          lParam;
  526.         LPFNPSPCALLBACK pfnCallback;
  527.         UINT FAR * pcRefParent;
  528. } AFX_OLDPROPSHEETPAGE;
  529.  
  530. // same goes for PROPSHEETHEADER
  531.  
  532. typedef struct _AFX_OLDPROPSHEETHEADER {
  533.         DWORD           dwSize;
  534.         DWORD           dwFlags;
  535.         HWND            hwndParent;
  536.         HINSTANCE       hInstance;
  537.         union {
  538.             HICON       hIcon;
  539.             LPCTSTR     pszIcon;
  540.         }DUMMYUNIONNAME;
  541.         LPCTSTR         pszCaption;
  542.  
  543.         UINT            nPages;
  544.         union {
  545.             UINT        nStartPage;
  546.             LPCTSTR     pStartPage;
  547.         }DUMMYUNIONNAME2;
  548.         union {
  549.             LPCPROPSHEETPAGE ppsp;
  550.             HPROPSHEETPAGE FAR *phpage;
  551.         }DUMMYUNIONNAME3;
  552.         PFNPROPSHEETCALLBACK pfnCallback;
  553. } AFX_OLDPROPSHEETHEADER;
  554. #endif // _WIN32_WCE
  555.  
  556. class CPropertyPage : public CDialog
  557. {
  558.     DECLARE_DYNAMIC(CPropertyPage)
  559.  
  560. // Construction
  561. public:
  562.     CPropertyPage();
  563.     CPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0);
  564.     CPropertyPage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
  565.     void Construct(UINT nIDTemplate, UINT nIDCaption = 0);
  566.     void Construct(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
  567.  
  568. // Attributes
  569.     AFX_OLDPROPSHEETPAGE m_psp;
  570.  
  571. // Operations
  572.     void CancelToClose();
  573.     void SetModified(BOOL bChanged = TRUE);
  574.     LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam);
  575.  
  576. // Overridables
  577. public:
  578.     virtual BOOL OnApply();
  579.     virtual void OnReset();
  580.     virtual void OnOK();
  581.     virtual void OnCancel();
  582.     virtual BOOL OnSetActive();
  583.     virtual BOOL OnKillActive();
  584.     virtual BOOL OnQueryCancel();
  585.  
  586. WCE_DEL    virtual LRESULT OnWizardBack();
  587. WCE_DEL    virtual LRESULT OnWizardNext();
  588. WCE_DEL    virtual BOOL OnWizardFinish();
  589.  
  590. // Implementation
  591. public:
  592.     virtual ~CPropertyPage();
  593. #ifdef _DEBUG
  594.     virtual void AssertValid() const;
  595.     virtual void Dump(CDumpContext& dc) const;
  596. #endif
  597.     void EndDialog(int nEndID); // called for error scenarios
  598.  
  599. protected:
  600.     // private implementation data
  601.     CString m_strCaption;
  602.     BOOL m_bFirstSetActive;
  603.  
  604.     // implementation helpers
  605.     void CommonConstruct(LPCTSTR lpszTemplateName, UINT nIDCaption);
  606.     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  607.     virtual BOOL PreTranslateMessage(MSG*);
  608. WCE_DEL    LRESULT MapWizardResult(LRESULT lToMap);
  609.     BOOL IsButtonEnabled(int iButton);
  610.  
  611. WCE_DEL void PreProcessPageTemplate(PROPSHEETPAGE& psp, BOOL bWizard);
  612. #ifndef _AFX_NO_OCC_SUPPORT
  613.     void Cleanup();
  614.     const DLGTEMPLATE* InitDialogInfo(const DLGTEMPLATE* pTemplate);
  615. #endif
  616.  
  617.     // Generated message map functions
  618.     //{{AFX_MSG(CPropertyPage)
  619.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  620.     //}}AFX_MSG
  621.     DECLARE_MESSAGE_MAP()
  622.  
  623.     friend class CPropertySheet;
  624.     friend class CPropertySheetEx;
  625. };
  626.  
  627. #if !defined(_WIN32_WCE)
  628. class CPropertyPageEx : public CPropertyPage
  629. {
  630.     DECLARE_DYNAMIC(CPropertyPageEx)
  631.  
  632. // Construction
  633. public:
  634.     CPropertyPageEx();
  635.     CPropertyPageEx(UINT nIDTemplate, UINT nIDCaption = 0, 
  636.         UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  637.     CPropertyPageEx(LPCTSTR lpszTemplateName, UINT nIDCaption = 0, 
  638.         UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  639.     void Construct(UINT nIDTemplate, UINT nIDCaption = 0, 
  640.         UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  641.     void Construct(LPCTSTR lpszTemplateName, UINT nIDCaption = 0, 
  642.         UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  643.  
  644. // Implementation
  645. public:
  646. #ifdef _DEBUG
  647.     virtual void AssertValid() const;
  648.     virtual void Dump(CDumpContext& dc) const;
  649. #endif
  650.  
  651. protected:
  652.     // private implementation data
  653.     CString m_strHeaderTitle;    // this is displayed in the header
  654.     CString m_strHeaderSubTitle; //
  655.  
  656.     // implementation helpers
  657.     void CommonConstruct(LPCTSTR lpszTemplateName, UINT nIDCaption, 
  658.         UINT nIDHeaderTitle, UINT nIDHeaderSubTitle);
  659.  
  660.     friend class CPropertySheet;
  661.     friend class CPropertySheetEx;
  662. };
  663. #endif // _WIN32_WCE
  664.  
  665. ////////////////////////////////////////////////////////////////////////////
  666. // CPropertySheet -- a tabbed "dialog" (really a popup-window)
  667.  
  668. class CTabCtrl; // forward reference (see afxcmn.h)
  669.  
  670. class CPropertySheet : public CWnd
  671. {
  672.     DECLARE_DYNAMIC(CPropertySheet)
  673.  
  674. // Construction
  675. public:
  676.     CPropertySheet();
  677.     CPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL,
  678.         UINT iSelectPage = 0);
  679.     CPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  680.         UINT iSelectPage = 0);
  681.     void Construct(UINT nIDCaption, CWnd* pParentWnd = NULL,
  682.         UINT iSelectPage = 0);
  683.     void Construct(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  684.         UINT iSelectPage = 0);
  685.  
  686.     // for modeless creation
  687.     BOOL Create(CWnd* pParentWnd = NULL, DWORD dwStyle = (DWORD)-1,
  688.         DWORD dwExStyle = 0);
  689.     // the default style, expressed by passing -1 as dwStyle, is actually:
  690.     // WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXT_HELP | WS_VISIBLE
  691.  
  692. // Attributes
  693. public:
  694.     AFX_OLDPROPSHEETHEADER m_psh;
  695.  
  696.     int GetPageCount() const;
  697.     CPropertyPage* GetActivePage() const;
  698.     int GetActiveIndex() const;
  699.     CPropertyPage* GetPage(int nPage) const;
  700.     int GetPageIndex(CPropertyPage* pPage);
  701.     BOOL SetActivePage(int nPage);
  702.     BOOL SetActivePage(CPropertyPage* pPage);
  703.     void SetTitle(LPCTSTR lpszText, UINT nStyle = 0);
  704.     CTabCtrl* GetTabControl() const;
  705.  
  706. WCE_DEL    void SetWizardMode();
  707. WCE_DEL    void SetFinishText(LPCTSTR lpszText);
  708. WCE_DEL    void SetWizardButtons(DWORD dwFlags);
  709.  
  710.     void EnableStackedTabs(BOOL bStacked);
  711.  
  712. // Operations
  713. public:
  714.     virtual int DoModal();
  715.     void AddPage(CPropertyPage* pPage);
  716.     void RemovePage(CPropertyPage* pPage);
  717.     void RemovePage(int nPage);
  718.     void EndDialog(int nEndID); // used to terminate a modal dialog
  719.     BOOL PressButton(int nButton);
  720.  
  721. // Implementation
  722. public:
  723.     virtual ~CPropertySheet();
  724. #ifdef _DEBUG
  725.     virtual void AssertValid() const;
  726.     virtual void Dump(CDumpContext& dc) const;
  727. #endif
  728.     void CommonConstruct(CWnd* pParentWnd, UINT iSelectPage);
  729.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  730.     virtual void BuildPropPageArray();
  731.     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  732.     virtual BOOL OnInitDialog();
  733.     virtual BOOL ContinueModal();
  734.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  735.         AFX_CMDHANDLERINFO* pHandlerInfo);
  736.     AFX_OLDPROPSHEETHEADER* GetPropSheetHeader();   // should be virtual, but can't break binary compat yet
  737.     BOOL IsWizard() const;
  738.  
  739. protected:
  740.     CPtrArray m_pages;      // array of CPropertyPage pointers
  741.     CString m_strCaption;   // caption of the pseudo-dialog
  742.     CWnd* m_pParentWnd;     // parent window of property sheet
  743.     BOOL m_bStacked;        // EnableStackedTabs sets this
  744.     BOOL m_bModeless;       // TRUE when Create called instead of DoModal
  745.  
  746.     // Generated message map functions
  747.     //{{AFX_MSG(CPropertySheet)
  748. WCE_DEL    afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
  749.     afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
  750.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  751.     afx_msg LRESULT OnCommandHelp(WPARAM, LPARAM);
  752.     afx_msg void OnClose();
  753.     afx_msg void OnSysCommand(UINT nID, LPARAM);
  754.     afx_msg LRESULT OnSetDefID(WPARAM, LPARAM);
  755.     //}}AFX_MSG
  756.     DECLARE_MESSAGE_MAP()
  757.  
  758.     friend class CPropertyPage;
  759. };
  760.  
  761. #if !defined(_WIN32_WCE)
  762. ////////////////////////////////////////////////////////////////////////////
  763. // CPropertySheetEx -- a tabbed "dialog" (really a popup-window), extended
  764. //                     for IE4
  765.  
  766. class CPropertySheetEx : public CPropertySheet
  767. {
  768.     DECLARE_DYNAMIC(CPropertySheetEx)
  769.  
  770. // Construction
  771. public:
  772.     CPropertySheetEx();
  773.     CPropertySheetEx(UINT nIDCaption, CWnd* pParentWnd = NULL,
  774.         UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  775.         HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  776.     CPropertySheetEx(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  777.         UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  778.         HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  779.     void Construct(UINT nIDCaption, CWnd* pParentWnd = NULL,
  780.         UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  781.         HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  782.     void Construct(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  783.         UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  784.         HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  785.  
  786. // Attributes
  787. public:
  788.     PROPSHEETHEADER m_psh;
  789.  
  790. // Operations
  791. public:
  792.     void AddPage(CPropertyPageEx* pPage);
  793.  
  794. // Implementation
  795. public:
  796.     virtual ~CPropertySheetEx();
  797. #ifdef _DEBUG
  798.     virtual void AssertValid() const;
  799.     virtual void Dump(CDumpContext& dc) const;
  800. #endif
  801.     void CommonConstruct(CWnd* pParentWnd, UINT iSelectPage,
  802.         HBITMAP hbmWatermark, HPALETTE hpalWatermark, HBITMAP hbmHeader);
  803.     virtual void BuildPropPageArray();
  804.     void SetWizardMode();
  805.  
  806.     friend class CPropertyPage;
  807.     friend class CPropertyPageEx;
  808. };
  809. #endif // _WIN32_WCE
  810.  
  811. /////////////////////////////////////////////////////////////////////////////
  812. // Inline function declarations
  813.  
  814. #ifdef _AFX_PACKING
  815. #pragma pack(pop)
  816. #endif
  817.  
  818. #ifdef _AFX_ENABLE_INLINES
  819. #define _AFXDLGS_INLINE AFX_INLINE
  820. #include <afxdlgs.inl>
  821. #endif
  822.  
  823. #undef AFX_DATA
  824. #define AFX_DATA
  825.  
  826. #ifdef _AFX_MINREBUILD
  827. #pragma component(minrebuild, on)
  828. #endif
  829. #ifndef _AFX_FULLTYPEINFO
  830. #pragma component(mintypeinfo, off)
  831. #endif
  832.  
  833. #endif //__AFXDLGS_H__
  834.  
  835. /////////////////////////////////////////////////////////////////////////////
  836.